//
//  AlbumCollectionViewCell.m
//  LoveOfPet
//
//  Created by 芦彬 on 15/11/17.
//  Copyright © 2015年 孔维. All rights reserved.
//

#import "AlbumCollectionViewCell.h"
#import "LuBDefine.h"
#import "SDWebImageManager.h"
#import "UIImageView+WebCache.h"

@implementation AlbumCollectionViewCell

- (void)dealloc{
    [_album release];
    [_photoImageView release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createAlbumCollectionViewCell];
    }
    return self;
}

- (void)createAlbumCollectionViewCell{
    
    self.photoImageView = [[UIImageView alloc]init];
    self.photoImageView.backgroundColor =[UIColor purpleColor];
    [self addSubview:_photoImageView];
    self.photoImageView.layer.shadowColor = [[UIColor grayColor] CGColor];
    self.photoImageView.layer.shadowOffset = CGSizeMake(5, 5);
    self.photoImageView.layer.shadowOpacity = 1;

    self.photoImageView.layer.borderWidth = 5;
    self.photoImageView.layer.borderColor = [[UIColor whiteColor] CGColor];
    [_photoImageView release];
}

- (void)layoutSubviews{
    self.photoImageView.frame = CGRectMake(10, 10, WIDTH - 20, HEIGHT - 20);
}

- (void)setAlbum:(Album *)album{
    if (_album != album) {
        [_album release];
        _album = [album retain];
    }
    NSURL *url = [NSURL URLWithString:album.photo];
    [self.photoImageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"zhanweitu.jpg"]];
    
}

@end
